Skip to content

Why a LSP?

  • Large number of IDEs, why I need to rewrite a compiler several times for each different languages/environment?
  • a good principle could be (good enough approach):
  • define generic editing features
  • use a language specific configuration using an external service

  • is possible provide a correct separation of responsibilities:

  • editor developers are focused on the editor part (provide plugin, new functionality)
  • language developers are focused on the language support to provide for all the IDEs

  • any developer - any language - any tool

Lsp manifest

How it works on hi-level

  • the ide will connect to the language server
  • the language server is a separate component (usually a background process)
  • the communication between two components is realized using JSON RPC messages

Lsp manifest

LSP Java implementation = LSP4J

  • Java implementation of LSP
  • JSON messages communication, result wrapped in a object with methods and so on
  • APIs for implement LSP (interfaces)
  • client/server endpoints

Workthough example

||define this snippet with gist

  • client invocation: auto-complete request snippet

  • JSON RPC: JSON RPC call

Manage a LSP

  1. use a defined SDK and implement the specifications
  2. here the available SDKs: https://microsoft.github.io/language-server-protocol/implementors/sdks/
  3. here the specification rules: https://microsoft.github.io/language-server-protocol/specification
  4. use an already defined LSP servers to integrate in the IDE
  5. more info at https://microsoft.github.io/language-server-protocol/implementors/servers/